<template>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item v-for="( item , index) in swipeList " :key="'img' + index">
            <van-image fit="cover" :src="item.bannerurl" />
        </van-swipe-item>
    </van-swipe>
</template>
  
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { getSwipe } from '../../api/api';

// 轮播图数据
const swipeList = ref([])


// 获取轮播图
onMounted(async () => {
    const { data: res } = await getSwipe()
    // console.log(res);
    swipeList.value = res.data.data
    // console.log(swipeList.value);
})
</script>
  
<style scoped lang="scss">

.my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    // height: 150px;
    // line-height: 300px;
    text-align: center;
    // background-color: #39a9ed;
}

</style>